cmake_minimum_required(VERSION 2.6)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(login_server)

# find library
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

if (WINDOWS)
add_definitions(-D__WINDOWS__)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else ()
add_definitions(-D__LINUX__)
	if (CMAKE_COMPILER_IS_GNUCXX)
	add_definitions(-std=gnu++0x)
	else ()
	add_definitions(-std=stdc++11)
	endif()
endif()

if (DEBUG)
add_definitions(-D_DEBUG)
endif()

set(login_server_SOURCES
	Config.hpp
	Main.cpp
	
	net/LoginConnectionFactory.hpp
	net/LoginConnectionFactory.cpp

	main/LSMain.hpp
	main/LSMain.cpp
	main/LoginConnectManager.hpp
	main/LoginConnectManager.cpp
	
	player/LoginPlayer.hpp
	player/LoginPlayer.cpp
	player/LoginPlayerFactory.hpp
	player/LoginPlayerFactory.cpp
	player/LoginPlayerManager.hpp
	player/LoginPlayerManager.cpp
	
)

if (WINDOWS)
set(plat_SRC
)
else()
set(plat_SRC
)
endif()

if (WINDOWS)
include_directories( 
	"${PROJECT_SOURCE_DIR}/../"
	"${PROJECT_SOURCE_DIR}/../deps/dev"
)
else ()
include_directories(
	"${PROJECT_SOURCE_DIR}/../"
	"${PROJECT_SOURCE_DIR}/../deps/dev"
)
endif()

add_executable(login_server ${login_server_SOURCES} ${plat_SRC})
target_link_libraries(login_server dev common)
if (WINDOWS)
target_link_libraries(login_server ws2_32)
else()
target_link_libraries(login_server pthread rt boost_system)
endif()
